Skip to content

[6.16.z] Use Convert2RHEL repofiles instead of deprecated repos for tests - #20892

Merged
Satellite-QE merged 1 commit into
6.16.zfrom
cherry-pick-6.16.z-0644d11f807200c8014d37d1ac667fccd0952529
Feb 26, 2026
Merged

[6.16.z] Use Convert2RHEL repofiles instead of deprecated repos for tests#20892
Satellite-QE merged 1 commit into
6.16.zfrom
cherry-pick-6.16.z-0644d11f807200c8014d37d1ac667fccd0952529

Conversation

@Satellite-QE

@Satellite-QE Satellite-QE commented Feb 26, 2026

Copy link
Copy Markdown
Collaborator

Cherrypick of PR: #20869

Problem Statement

Solution

Related Issues

Summary by Sourcery

Update Convert2RHEL tests to consume repository base URLs from remote repo files instead of hard-coded repo URLs.

New Features:

  • Add a helper to resolve a repository base URL from a remote yum .repo file.

Enhancements:

  • Adjust Convert2RHEL API tests to use the new helper and repofile URLs from settings rather than direct repository URLs.

)

Signed-off-by: Gaurav Talreja <gtalreja@redhat.com>
(cherry picked from commit 0644d11)
@Satellite-QE Satellite-QE added 6.16.z Auto_Cherry_Picked Automatically cherrypicked PR using GHA No-CherryPick PR doesnt need CherryPick to previous branches labels Feb 26, 2026
@Satellite-QE

Copy link
Copy Markdown
Collaborator Author
trigger: test-robottelo
pytest: tests/foreman/api/test_convert2rhel.py
env:
     ROBOTTELO_REPOS__CONVERT2RHEL__CONVERT_TO_RHEL_REPOFILE: https://cdn-public.redhat.com/content/public/repofiles/convert2rhel-for-rhel-{}-x86_64.repo

@Satellite-QE Satellite-QE added the AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing label Feb 26, 2026
@sourcery-ai

sourcery-ai Bot commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Adds a helper to derive a repository baseurl from a remote .repo file and updates Convert2RHEL API tests to use this helper and new repofile-based settings instead of deprecated direct repo URLs.

Class diagram for new get_baseurl_by_repofile helper

classDiagram
    class content_info {
        +get_repo_files_by_url(url, extension)
        +get_baseurl_by_repofile(repo_url, verify_ssl)
        +get_repomd(repo_url)
    }

    class requests {
        +get(url, verify, timeout)
    }

    content_info ..> requests : uses
Loading

Flow diagram for get_baseurl_by_repofile logic

flowchart TD
    A[Start get_baseurl_by_repofile] --> B[Call requests.get with repo_url, verify_ssl, timeout 10]
    B --> C[response.raise_for_status]
    C --> D[Split response.text into lines]
    D --> E[For each line]
    E --> F[Strip line]
    F --> G{Does line start with baseurl=}
    G -- Yes --> H[Extract substring after =]
    H --> I[Strip extracted value]
    I --> J[Return baseurl]
    G -- No --> K{More lines?}
    K -- Yes --> E
    K -- No --> L[Raise ValueError No baseurl found]
    J --> M[End]
    L --> M
Loading

File-Level Changes

Change Details Files
Introduce helper to extract baseurl from a remote yum .repo file URL.
  • Add get_baseurl_by_repofile that downloads a .repo file with requests, enforces HTTP success, parses lines for a baseurl entry, and returns its value.
  • Raise ValueError when no baseurl entry is present in the fetched .repo file.
robottelo/content_info.py
Update Convert2RHEL CentOS and Oracle API tests to use repofile-based base URLs.
  • Replace use of settings.repos.convert2rhel.convert_to_rhel_repo with convert_to_rhel_repofile for CentOS and Oracle tests.
  • Call get_baseurl_by_repofile on the repofile URL to obtain the repository baseurl used for create_repo in both tests.
tests/foreman/api/test_convert2rhel.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The get_baseurl_by_repofile parser is quite strict (line.startswith('baseurl=')) and will miss valid lines with spaces, uppercase keys, or multiple sections; consider using configparser or a regex that ignores comments/whitespace and handles key = value forms more robustly.
  • If a repofile contains multiple repository sections with different baseurl entries, the current implementation will silently return the first one; if that’s not guaranteed to be correct, it might be worth allowing a section/repo ID to be specified or at least asserting a single baseurl is present.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `get_baseurl_by_repofile` parser is quite strict (`line.startswith('baseurl=')`) and will miss valid lines with spaces, uppercase keys, or multiple sections; consider using `configparser` or a regex that ignores comments/whitespace and handles `key = value` forms more robustly.
- If a repofile contains multiple repository sections with different `baseurl` entries, the current implementation will silently return the first one; if that’s not guaranteed to be correct, it might be worth allowing a section/repo ID to be specified or at least asserting a single baseurl is present.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Satellite-QE

Copy link
Copy Markdown
Collaborator Author

PRT Result

Build Number: 14494
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/api/test_convert2rhel.py --external-logging
Test Result : ================ 4 passed, 246 warnings in 13338.94s (3:42:18) =================

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Feb 26, 2026
@Satellite-QE
Satellite-QE merged commit c912538 into 6.16.z Feb 26, 2026
18 of 20 checks passed
@Satellite-QE
Satellite-QE deleted the cherry-pick-6.16.z-0644d11f807200c8014d37d1ac667fccd0952529 branch February 26, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.16.z Auto_Cherry_Picked Automatically cherrypicked PR using GHA AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing No-CherryPick PR doesnt need CherryPick to previous branches PRT-Passed Indicates that latest PRT run is passed for the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants